package com.gmzg.gmzgnews.topic.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.gmzg.gmzgnews.topic.view.BaseFragment;

import java.util.List;

/**
 * Created by liuyi_s on 2016/11/1 10:37.
 * Email：liuyi_s@foxmail.com
 */

public class CommonFragmentAdapter extends FragmentPagerAdapter {

    private List<BaseFragment> mFragments;

    public CommonFragmentAdapter(FragmentManager fm, List<BaseFragment> fragments) {
        super(fm);
        mFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragments.get(position).getFragmentTitle();
    }
}
